package com.sk.cardeal.act.home.activity;

import android.os.Bundle;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;

import com.sk.cardeal.R;
import com.sk.cardeal.act.home.fragment.MyOrderFragment;
import com.sk.cardeal.act.home.fragment.NormalVipFragment;
import com.sk.cardeal.act.home.fragment.TemporaryFragment;
import com.sk.cardeal.act.home.fragment.VipCustomFragment;
import com.sk.cardeal.adapter.MyPagerAdapter;
import com.sk.cardeal.base.BaseActivity;
import com.sk.cardeal.view.TitleView;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by sunke on 2018/2/27.
 */

public class MyOrderActivity extends BaseActivity {
    @BindView(R.id.title_view)
    TitleView titleView;
    @BindView(R.id.my_table)
    TabLayout myTable;
    @BindView(R.id.my_pager)
    ViewPager myPager;
    private List<Fragment> fragmentList = new ArrayList<>();

    @Override
    protected int getContentView() {
        return R.layout.activity_my_order;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        titleView.setMyCallBack(this);
        initFragments();
    }

    @Override
    public void clickTitle(int i) {
        super.clickTitle(i);
        switch (i){
            case 1:
                finish();
                break;
        }
    }

    private void initFragments() {

        MyOrderFragment myOrderFragment1 = MyOrderFragment.newInstance(1);
        MyOrderFragment myOrderFragment2 = MyOrderFragment.newInstance(1);
        MyOrderFragment myOrderFragment3 = MyOrderFragment.newInstance(1);

        fragmentList.add(myOrderFragment1);
        fragmentList.add(myOrderFragment2);
        fragmentList.add(myOrderFragment3);

        MyPagerAdapter adapter = new MyPagerAdapter(getSupportFragmentManager(), getResources().getStringArray(R.array.my_order), fragmentList);
        myPager.setAdapter(adapter);
        myTable.setupWithViewPager(myPager);
    }

}
